<div id="leftcol">
	filter fields
</div>
<div id='centercol'>
<?php
	$elements = array(
		'images' => array(),
		'names' => array(),
		//addtocart
		'prices' => array(),
		'materials' => array(),
		'warentees' => array(),
		'descriptions' => array(),
		'specifications' => array(),
		'comments_count' => array(),
		'manufacture_times' => array(),
		'ids' => array(),
		'lengths' => array(),
		'widths' => array(),
		'heights' => array(),
		'parts' => array(),
		'labours' => array()
	);
	
	foreach($this->products as $product) {
		if (isset($product->productimages[0]->name)) {
			array_push($elements['images'], array('imgname' => $product->productimages[0]->name, 'id' => $product->id));
			//array_push($elements['images'], $product->productimages[0]->name);
		}
		else {
			array_push($elements['images'], 'No image for this product currently'); 
		}
		array_push($elements['names'], array('name' => $product->name, 'id' => $product->id) );
		array_push($elements['prices'], $product->price );
		array_push($elements['materials'], $product->material );
		array_push($elements['warentees'], $product->warentee );
		array_push($elements['descriptions'], $product->description );
		array_push($elements['specifications'], $product->specification );
		array_push($elements['comments_count'], $product->comments_count );
		array_push($elements['manufacture_times'], $product->manufacture_time );
		array_push($elements['ids'], $product->id );
		array_push($elements['lengths'], $product->length );
		array_push($elements['widths'], $product->width );
		array_push($elements['heights'], $product->height );
		array_push($elements['parts'], $product->parts );
		array_push($elements['labours'], $product->labour );
	}

echo '<table>';
	foreach($elements as $key => $element) {
		echo '<tr>';
			if ($key == 'images') {
				//print_r($element);
 				foreach($element as $e1) {
 					echo '<td class="col">', link_to(image_tag("thumb/{$e1['imgname']}"), array("action" => "viewProduct", "id" => $e1['id'])) , "</td>";
 				}
			}
			elseif ($key == 'names') {
				foreach($element as $e1) {
 					echo '<td class="col">', link_to($e1['name'], array("action" => "viewProduct", "id" => $e1['id'])) , "</td>";
 				}
			}
			else {
				foreach($element as $e1) {
					echo '<td class="col">', $e1 , "</td>";
				}
			}
		echo '</tr>';
	}
echo '</table>';

/*
$len = count($this->products);
echo '<table>';
	echo '<tr>';
	for($i = 0; $i<$len; $i++) {
		echo '<td>', link_to(image_tag("thumb/{$elements['images'][$i]}"), array("action" => "viewProduct", "id" => $elements['ids'][$i])), '</td>';
	}
	echo '</tr>';
	echo '<tr>';
	for($i = 0; $i<$len; $i++) {
		echo '<td>', link_to(image_tag("thumb/{$elements['images'][$i]}"), array("action" => "viewProduct", "id" => $elements['ids'][$i])), '</td>';
	}
	echo '</tr>';
echo '</table>';
*/

?>



</div>


<!--
<div id="centercol">
	<div id='products'>
		<?php foreach($this->products as $product): ?>
			<div class='item'>
				<?php
					print_r($product);
					echo '<div class="image">';
						if (isset($product->productimages[0])) {
							echo link_to(image_tag("thumb/{$product->productimages[0]->name}"), array("action" => "viewProduct", "id" => $product->id));
						}
						else {
							echo 'No image available';
						}
					echo '</div>';
					echo '<div class="price">',
							"Price: $", $product->price,
							'<br />',
							link_to('Add to Cart', array('action' => 'addToCart', 'id' => $product->id)),
						'</div>',
						'<div class="namedescription">',
							link_to($product->name, array("action" => "viewProduct", "id" => $product->id)),
							'<ul>',
								'<li>',
									'Dimensions: ', $product->get_dimensions(),
								'</li>',
								'<li>',
									'Material: ', $product->material,
								'</li>',
							'</ul>',
						'</div>';
				?>
			</div>
		<?php endforeach; ?>
	</div>
</div>
-->